/**************************************************************************
 * @file usr_app_common_inc.h
 * @author BryanHe(贺璧) (532352406@qq.com)
 * @brief 
 * @version 0.1
 * @date 2024-11-11
 * 
 * @copyright Copyright (c) 2024
 * 
 *************************************************************************/
#ifndef USR_APP_COMMON_INC__H_H
#define USR_APP_COMMON_INC__H_H
#include<stdint.h>
#include<stdio.h>

#ifdef __cplusplus
extern "C"{
#endif

#include "mo_config.h"
#include "mcu_button.h"
#include "mo_input.h"
#include "mo_msg.h"
#include "usr_input_task.h"
#include "at32f421_adc.h"
#include "usr_adc_handle.h"

typedef struct monitor_datas_{
    mo_u32 in_vol;
    mo_u32 in_curr;
    mo_u32 out_vol;
    mo_u32 out_curr;
    mo_s32 measured_in_vl;
}MonitorDatsT;


typedef enum{
    UI_HOME_M,
    UI_CURVE_M,

    UI_MODE_MAX__
}UI_MODE_T;

typedef enum {
    CFG_MODE_NULL=0,

    VOL_CFG_M,
    CURR_CFG_M,

    CFG_MODE_MAX__
}CFG_MODE_T;

typedef enum {
    PD_REQ_5V,
    PD_REQ_9V,
    PD_REQ_12V,
    PD_REQ_15V,
    PD_REQ_20V,
    PD_REQ_MAX___
}PD_REQ_VOL_T;

typedef enum{
    OUT_CTRL_DISABLE=0,
    OUT_CTRL_ENABLE=1,
    OUT_CTRL_LOW_CURRENT_ROUTE,
    OUT_CTRL_HIGH_CURRENT_ROUTE,

}OUT_CTRL_T;

#define DEFAULT_OUT_CURRENT_ROUTE  OUT_CTRL_HIGH_CURRENT_ROUTE

typedef enum{
    CV_MODE,
    CC_MODE,

    CC_CV_MAX__
}CC_CV_MODE;

extern const mo_u32 _10_pw_table[10ul];
int get_string_by_number(mo_u32 num,mo_u8 *p_str_buf,mo_u8 str_len,mo_u8 dele_high_zeo_flg);

#ifdef __cplusplus
}
#endif

#endif //USR_APP_COMMON_INC__H_H


